package com.fs.zise;

import Appconst.GameConst;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ScrollView;
import audio.GameMedia;

public class ZiSeActivity extends Activity {
	/** Called when the activity is first created. */
	public GameSurfaceView mGameSurfaceView;
	/** Called when the activity is first created. */
	
	private static ZiSeActivity ziseActivity = null;
	public static ZiSeActivity getActivity(){
		   return ziseActivity;
		}
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //����ȫ��
		
		DisplayMetrics dm = new DisplayMetrics();
		this.getWindowManager().getDefaultDisplay().getMetrics(dm);
		GameConst.SCR_W = dm.widthPixels;
		GameConst.SCR_H = dm.heightPixels;
		System.out.println("不同机器有不同的分辨率 ="+dm.density);
//		System.out.println("LlkConst.SCR_W ="+LlkConst.SCR_W);
//		System.out.println("LlkConst.SCR_H ="+LlkConst.SCR_H);
		
//		WindowManager windowManager = getWindowManager();
//		int moniqiW = windowManager.getDefaultDisplay().getWidth();
//		System.out.println("moniqiW ="+moniqiW);
//		int moniqiH = windowManager.getDefaultDisplay().getHeight();
//		System.out.println("moniqiH ="+moniqiH);
		
		ziseActivity = this;
		/* ����GameSurfaceView���� */
		mGameSurfaceView = new GameSurfaceView(this);
		
		
		//������ʾGameSurfaceView��ͼ
		setContentView(mGameSurfaceView);
	
//		startActivityForResult(intent,10);
	}
	

	
	int firstEnter = 0;
	int old_gameState = 0;
	
	 @Override
		public void onWindowFocusChanged(boolean hasFocus) {
			super.onWindowFocusChanged(hasFocus);
			if (!hasFocus)
			{
//				 old_gameState  = mGameSurfaceView.gameState; 
//				mGameSurfaceView.pauseSound();
//				GameMedia.pauseMusic();
				System.out.println("暂停。。。。。。。。。");
				
			}
			else
			{ 
				if(firstEnter >=1)
				{
//					if(mGameSurfaceView.gameState == GameConst.STATE_GAME)
//							GameMedia.resumeMusic();
//					mGameSurfaceView.gameState = old_gameState;
//					mGameSurfaceView.playSound();
				}
				System.out.println("开始。。。。。。。。。");
				firstEnter++;
			}
		}
	@Override
	protected void onPause() {
		super.onPause();
	}
	
	@Override
	protected void onResume() {
		super.onResume();
	};
	
	@Override
	protected void onRestart() {
		super.onRestart();
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		
	}
	
}